home *** CD-ROM | disk | FTP | other *** search
/ Enter 2001 November / EnterCD 11_2001.iso / Uzupelnienia / DHTML Menu Builder Przyklady / Gotowe menu / menu.js < prev    next >
Encoding:
JavaScript  |  2001-09-21  |  21.4 KB  |  656 lines

  1. ////////////////////////////////////////////////
  2. //  DHTML MENU BUILDER 2.8.15                 //
  3. //  (c)xFX JumpStart                          //
  4. //                                            //
  5. //  PSN: 175417-TWB-3475-437F                 //
  6. //                                            //
  7. //  GENERATED: 21-09-2001 - 13:25:06          //
  8. ////////////////////////////////////////////////
  9.  
  10.  
  11.     var nStyle = new Array;
  12.     var hStyle = new Array;
  13.     var nLayer = new Array;
  14.     var hLayer = new Array;
  15.     var nTCode = new Array;
  16.  
  17.     var AnimStep = 0;
  18.     var AnimHnd = 0;
  19.     var HTHnd = new Array;
  20.     var DoFormsTweak = true;
  21.  
  22.     var mFrame;
  23.     var cFrame;
  24.  
  25.     var OpenMenus = new Array;
  26.     var SelCommand;
  27.     var nOM = 0;
  28.  
  29.     var mX;
  30.     var mY;
  31.     var xOff = 0;
  32.  
  33.     var HideSpeed = 300;
  34.  
  35. var BV=navigator.appVersion;
  36. BV=parseFloat(BV.indexOf('MSIE')>0?BV.split(';')[1].split(' ')[2]:BV.split(' ')[0]);
  37. var BN=window.navigator.appName;
  38. var IsWin=(navigator.userAgent.indexOf('Windows')!=-1)?true:false;
  39. var OP=(navigator.userAgent.indexOf('Opera')!=-1&&BV>=4)?true:false;
  40. var SM=(BN.indexOf('Netscape')!=-1&&(BV>=5)||OP)?true:false;
  41. var NS=(BN.indexOf('Netscape')!=-1&&!SM)?true:false;
  42. var IE=(BN.indexOf('Explorer')!=-1&&(BV>=4)||SM)?true:false;
  43.  
  44.  
  45.     if((!IsWin&&IE)||SM) {
  46.         frames.self = window;
  47.         frames.top = top;
  48.     }
  49.  
  50.     if(IE)
  51.         xOff = (SM&&!OP)?-9:2;
  52.     cFrame = eval(frames['self']);
  53.  
  54.     var fx = 2;
  55.  
  56.  
  57.  
  58.     hStyle[0]="border: 0; font-family: Tahoma; font-size: 8pt; font-weight: none; font-style: none; color: #FFFFFF; background-color: #0000FF; cursor: hand;";
  59.     hStyle[1]="border: 0; font-family: Tahoma; font-size: 8pt; font-weight: none; font-style: none; color: #FFFFFF; background-color: #0000FF; cursor: hand;";
  60.     nTCode[1]="frames[\'self\'].execURL(\'element_1.htm\', \'frames[self]\');";
  61.     nLayer[1]="<p align=left><font face=Tahoma point-size=8 color=#000000>Strona pierwsza</font>";
  62.     hLayer[1]="<p align=left><font face=Tahoma point-size=8 color=#FFFFFF>Strona pierwsza</font>";
  63.     nLayer[2]="";
  64.     hLayer[2]="";
  65.     nTCode[3]="frames[\'self\'].execURL(\'enter.jpg\', \'frames[self]\');";
  66.     nLayer[3]="<p align=left><font face=Tahoma point-size=8 color=#000000>Logo ENTERA</font>";
  67.     hLayer[3]="<p align=left><font face=Tahoma point-size=8 color=#FFFFFF>Logo ENTERA</font>";
  68.  
  69.  
  70.     function GetCurCmd(e) {
  71. //IE
  72. //This function will return the current command under the mouse pointer.
  73. //It will return null if the mouse is not over any command.
  74. //------------------------------
  75. //Version 1.5
  76. //
  77.         if(SM)
  78.             var cc = e;
  79.         else
  80.             var cc = mFrame.window.event.srcElement;
  81.         while(cc.id=="") {
  82.             cc = cc.parentElement;
  83.             if(cc==null)
  84.                 break;
  85.         }
  86.         return cc;
  87.     }
  88.  
  89.     function HoverSel(mode, imgLName, imgRName, e) {
  90. //IE
  91. //This is the function called every time the mouse pointer is moved over a command.
  92. //------------------------------
  93. //mode: 0 if the mouse is moving over the command and 1 if is moving away.
  94. //imgLName: Name of the left image object, if any.
  95. //imgRName: Name of the right image object, if any.
  96. //------------------------------
  97. //Version 10.0
  98. //
  99.         var imgL = new Image;
  100.         var imgLRsc = new Image;
  101.         var imgR = new Image;
  102.         var imgRRsc = new Image;
  103.         var nStyle;
  104.         var mc;
  105.         
  106.         if(mode==0 && OpenMenus[nOM].SelCommand!=null)
  107.             HoverSel(1);
  108.         
  109.         if(imgLName!="_")
  110.             var imgL = eval("mFrame.document.images['"+imgLName+"']");
  111.         if(imgRName!="_")
  112.             var imgR = eval("mFrame.document.images['"+imgRName+"']");
  113.         
  114.         if(mode==0) {
  115.             mc = GetCurCmd(e);
  116.             if(nOM>1)
  117.                 if(mc==OpenMenus[nOM-1].SelCommand)
  118.                     return false;
  119.             if(OpenMenus[nOM].SelCommand || nOM>1)
  120.                 while(!InMenu()&&nOM>1)
  121.                     Hide();
  122.             if(imgLName!='_') imgLRsc = eval(imgLName+"On");
  123.             if(imgRName!='_') imgRRsc = eval(imgRName+"On");
  124.             OpenMenus[nOM].SelCommand = mc;
  125.             OpenMenus[nOM].SelCommandPar = [imgLName,imgRName,SM?mc.getAttribute("style"):mc.style.cssText];
  126.             if(SM)
  127.                 mc.setAttribute("style", GetCStyle(mc.style) + hStyle[mc.id]);
  128.             else
  129.                 mc.style.cssText = GetCStyle(mc.style) + hStyle[mc.id];
  130.         } else {
  131.             mc = (mode==1)?OpenMenus[nOM].SelCommand:OpenMenus[nOM].Opener;
  132.             imgLName = (mode==1)?OpenMenus[nOM].SelCommandPar[0]:OpenMenus[nOM].OpenerPar[0];
  133.             imgRName = (mode==1)?OpenMenus[nOM].SelCommandPar[1]:OpenMenus[nOM].OpenerPar[1];
  134.             nStyle = (mode==1)?OpenMenus[nOM].SelCommandPar[2]:OpenMenus[nOM].OpenerPar[2];
  135.             mc.style.background = "";
  136.             if(SM)
  137.                 mc.setAttribute("style", nStyle);
  138.             else
  139.                 mc.style.cssText = nStyle;
  140.             if(imgLName!='_') imgLRsc = eval(imgLName+"Off");
  141.             if(imgRName!='_') imgRRsc = eval(imgRName+"Off");
  142.             window.status = "";
  143.             OpenMenus[nOM].SelCommand = null;            
  144.         }
  145.         
  146.         if(imgLName!='_') {
  147.             imgL = eval("mFrame.document.images."+imgLName);
  148.             imgL.src = imgLRsc.src;
  149.         }
  150.         if(imgRName!='_') {
  151.             imgR = eval("mFrame.document.images."+imgRName);
  152.             imgR.src = imgRRsc.src;
  153.         }
  154.         
  155.         return true;
  156.     }
  157.  
  158.     function NSHoverSel(mode, mc, bcolor) {
  159. //NS
  160. //This is the function called every time the mouse pointer is moved over or away from a command.
  161. //------------------------------
  162. //mode: 0 if the mouse is moving over the command and 1 if is moving away.
  163. //mc: Name of the layer that corresponds to the selected command.
  164. //n: Unique ID that identifies this command. Used to retrieve the data from the nLayer or hLayer array.
  165. //bcolor: Background color of the command. Ignored if the group uses a background image.
  166. //w: Width of the command's layer.
  167. //h: Height of the command's layer.
  168. //------------------------------
  169. //Version 11.0
  170. //
  171.         var n;
  172.         var LayerHTM;
  173.         
  174.         window.clearTimeout(CBparseInt(HTHnd[nOM]));HTHnd[nOM] = 0;
  175.         if(!nOM) return false;
  176.         
  177.         if(mode==0 && OpenMenus[nOM].SelCommand!=null)
  178.             NSHoverSel(1);
  179.         
  180.         if(mode==0) {
  181.             mc = mc.parentLayer.layers[mc.name.substr(0, mc.name.indexOf("EH"))];
  182.             n = CBparseInt(mc.name.substr(2));
  183.             if(nOM>1)
  184.                 if(mc==OpenMenus[nOM-1].SelCommand)
  185.                     return false;
  186.             while(!InMenu()&&nOM>1)
  187.                 Hide();
  188.             LayerHTM = hLayer[n];
  189.             OpenMenus[nOM].SelCommand = mc;
  190.             OpenMenus[nOM].SelCommandPar = mc.bgColor;
  191.             mc.bgColor = bcolor;
  192.         } else {
  193.             mc = (mode==1)?OpenMenus[nOM].SelCommand:OpenMenus[nOM].Opener;
  194.             bcolor = (mode==1)?OpenMenus[nOM].SelCommandPar:OpenMenus[nOM].OpenerPar;
  195.             n = CBparseInt(mc.name.substr(2));
  196.             LayerHTM = nLayer[n];
  197.             if(mc.parentLayer.background.src!="")
  198.                 mc.bgColor = null;
  199.             else
  200.                 mc.bgColor = bcolor;
  201.             window.status = "";
  202.             OpenMenus[nOM].SelCommand = null;
  203.         }
  204.         mc.clip.width = mc.parentLayer.parentLayer.clip.width - 2*mc.parentLayer.left;
  205.         mc.document.open();
  206.         mc.document.write(LayerHTM);
  207.         mc.document.close();
  208.  
  209.         return true;
  210.     }
  211.  
  212.     function Hide() {
  213. //IE,NS
  214. //This function hides the last opened group and it keeps hiding all the groups until
  215. //no more groups are opened or the mouse is over one of them.
  216. //Also takes care of reseting any highlighted commands.
  217. //------------------------------
  218. //Version 3.5
  219. //
  220.         window.clearTimeout(HTHnd[nOM]);HTHnd[nOM] = 0;
  221.         window.clearTimeout(AnimHnd);AnimHnd = 0;
  222.  
  223.         if(OpenMenus[nOM].SelCommand!=null) {
  224.             if(IE) HoverSel(1);
  225.             if(NS) NSHoverSel(1);
  226.         }
  227.         if(OpenMenus[nOM].Opener!=null) {
  228.             if(IE) HoverSel(3);
  229.             if(NS) NSHoverSel(3);
  230.         }
  231.  
  232.         OpenMenus[nOM].visibility = "hidden";
  233.         nOM--;
  234.  
  235.         if(nOM>0)
  236.             if(!InMenu())
  237.                 HTHnd[nOM] = window.setTimeout("Hide()", HideSpeed/4);
  238.  
  239.         if(nOM==0)
  240.             FormsTweak("visible");
  241.     }
  242.  
  243.     function ShowMenu(mName, x, y, isCascading) {
  244. //IE,NS
  245. //This is the main function to show the menus when a hotspot is triggered or a cascading command is activated.
  246. //------------------------------
  247. //mName: Name of the <div> or <layer> to be shown.
  248. //x: Left position of the menu.
  249. //y: Top position of the menu.
  250. //isCascading: True if the menu has been triggered from a command, and not from a hotspot.
  251. //------------------------------
  252. //Version 14.5
  253. //
  254.         window.clearTimeout(CBparseInt(HTHnd[nOM]));HTHnd[nOM] = 0;
  255.         x = CBparseInt(x);y = CBparseInt(y);
  256.         
  257.         if(AnimHnd && nOM>0) {
  258.             AnimStep=101;
  259.             Animate();
  260.         }
  261.         if(IE)
  262.             if(SM)
  263.                 var Menu = mFrame.document.getElementById(mName);
  264.             else
  265.                 var Menu = mFrame.document.all[mName];
  266.         if(NS)
  267.             var Menu = mFrame.document.layers[mName];
  268.         if(!Menu)
  269.             return false;
  270.         if(IE)
  271.             Menu = Menu.style;
  272.         if(Menu==OpenMenus[nOM])
  273.             return false;
  274.             
  275.         if(!isCascading)
  276.             HideAll();
  277.             
  278.         Menu.Opener = nOM>0?OpenMenus[nOM].SelCommand:null;
  279.         Menu.OpenerPar = nOM>0?OpenMenus[nOM].SelCommandPar:null;
  280.         Menu.SelCommand = null;
  281.         if(OP) {
  282.             Menu.width = Menu.pixelWidth;
  283.             Menu.height = Menu.pixelHeight;
  284.         }
  285.  
  286.         var pW = GetWidthHeight()[0] + GetLeftTop()[0];
  287.         var pH = GetWidthHeight()[1] + GetLeftTop()[1];
  288.         
  289.         if(IE) {
  290.             if(isCascading) {
  291.                 x = CBparseInt(OpenMenus[nOM].left) + CBparseInt(OpenMenus[nOM].width) - 6;
  292.                 y = CBparseInt(OpenMenus[nOM].SelCommand.style.top) + CBparseInt(OpenMenus[nOM].top) - y;
  293.                 Menu.left = (x+CBparseInt(Menu.width)>pW)?CBparseInt(OpenMenus[nOM].left) - CBparseInt(Menu.width) + 6:x;
  294.                 Menu.top =  (y+CBparseInt(Menu.height)>pH)?pH - CBparseInt(Menu.height):y;
  295.             } else {
  296.                 Menu.left = (x+CBparseInt(Menu.width)>pW)?pW - CBparseInt(Menu.width):x;
  297.                 Menu.top =  (y+CBparseInt(Menu.height)>pH)?pH - CBparseInt(Menu.height):y;
  298.             }
  299.             if(IsWin&&!SM)
  300.                 Menu.clip = "rect(0 0 0 0)";
  301.         }
  302.         if(NS) {
  303.             if(isCascading) {
  304.                 x = OpenMenus[nOM].left + OpenMenus[nOM].clip.width - 6;
  305.                 y = OpenMenus[nOM].top + OpenMenus[nOM].SelCommand.top;
  306.                 x = (x+Menu.w>pW)?OpenMenus[nOM].left - Menu.w + 6:x;
  307.                 y = (y+Menu.h>pH)?pH - Menu.h:y;
  308.             } else {
  309.                 x = (x+Menu.w>pW)?pW - Menu.w:x;
  310.                 y = (y+Menu.h>pH)?pH - Menu.h:y;
  311.             }
  312.             Menu.clip.width = 0;
  313.             Menu.clip.height = 0;
  314.             Menu.moveToAbsolute(x,y);
  315.         }
  316.         if(isCascading)
  317.             Menu.zIndex = CBparseInt(OpenMenus[nOM].zIndex) + 1;
  318.         Menu.visibility = "visible";
  319.         OpenMenus[++nOM] = Menu;
  320.         HTHnd[nOM] = 0;
  321.         if((IE&&IsWin&&!SM)||NS)
  322.             AnimHnd = window.setTimeout("Animate()", 10);
  323.         FormsTweak("hidden");
  324.  
  325.         return true;
  326.     }
  327.  
  328.     function Animate() {
  329. //IE,NS
  330. //This function is called by ShowMenu every time a new group must be displayed and produces the predefined unfolding effect.
  331. //Currently is disabled for Navigator, because of some weird bugs we found with the clip property of the layers.
  332. //------------------------------
  333. //Version 1.9
  334. //
  335.         var r = '';
  336.         var nw = nh = 0;
  337.         switch(fx) {
  338.             case 1:
  339.                 if(IE) r = "0 " + AnimStep + "% " + AnimStep + "% 0";
  340.                 if(NS) nw = AnimStep; nh = AnimStep;
  341.                 break;
  342.             case 2:
  343.                 if(IE) r = "0 100% " + AnimStep + "% 0";
  344.                 if(NS) nw = 100; nh = AnimStep;
  345.                 break;
  346.             case 3:
  347.                 if(IE) r = "0 " + AnimStep + "% 100% 0";
  348.                 if(NS) nw = AnimStep; nh = 100;
  349.                 break;
  350.             case 0:
  351.                 if(IE) r = "0 100% 100% 0";
  352.                 if(NS) nw = 100; nh = 100;
  353.                 break;
  354.         }
  355.         if(OpenMenus[nOM]) {
  356.             with(OpenMenus[nOM]) {
  357.                 if(IE)
  358.                     clip =  "rect(" + r + ")";
  359.                 if(NS) {
  360.                     clip.width = w*(nw/100);
  361.                     clip.height = h*(nh/100);
  362.                 }
  363.             }
  364.             AnimStep += 20;
  365.             if(AnimStep<=100)
  366.                 AnimHnd = window.setTimeout("Animate()",25);
  367.             else {
  368.                 window.clearTimeout(AnimHnd);
  369.                 AnimStep = 0;
  370.                 AnimHnd = 0;
  371.             }
  372.         }
  373.     }
  374.     
  375.     function InMenu() {
  376. //IE,NS
  377. //This function returns true if the mouse pointer is over the last opened menu.
  378. //------------------------------
  379. //Version 1.6
  380. //
  381.         var m = OpenMenus[nOM];
  382.         if(!m)
  383.             return false;
  384.         if(IE&&!SM)
  385.             SetPointerPos();            
  386.         var l = CBparseInt(m.left) + xOff;
  387.         var r = l+(IE?CBparseInt(m.width):m.clip.width) - xOff;
  388.         var t = CBparseInt(m.top) + xOff;
  389.         var b = t+(IE?CBparseInt(m.height):m.clip.height) - xOff;
  390.         return ((mX>=l && mX<=r) && (mY>=t && mY<=b));
  391.     }
  392.  
  393.     function SetPointerPos(e) {
  394. //IE,NS
  395. //This function sets the mX and mY variables with the current position of the mouse pointer.
  396. //------------------------------
  397. //e: Only used under Navigator, corresponds to the Event object.
  398. //------------------------------
  399. //Version 1.2
  400. //
  401.         if(IE) {
  402.             if(!SM) {
  403.                 if(mFrame!=cFrame||event==null)
  404.                     if(mFrame.window.event==null)
  405.                         return;
  406.                     else
  407.                         e = mFrame.window.event;
  408.                 else
  409.                     e = event;
  410.             }
  411.             mX = e.clientX + GetLeftTop()[0];
  412.             mY = e.clientY + GetLeftTop()[1];
  413.         }
  414.         if(NS) {
  415.             mX = e.pageX;
  416.             mY = e.pageY;
  417.         }
  418.     }
  419.     
  420.  
  421.     function HideMenus(e) {
  422. //IE,NS
  423. //This function checks if the mouse pointer is on a valid position and if the current menu should be kept visible.
  424. //The function is called every time the mouse pointer is moved over the document area.
  425. //------------------------------
  426. //e: Only used under Navigator, corresponds to the Event object.
  427. //------------------------------
  428. //Version 25.0
  429. //
  430.         if(nOM>0) {
  431.             SetPointerPos(e);
  432.             if(OpenMenus[nOM].SelCommand!=null)
  433.                 if(!InMenu()&&!HTHnd[nOM])
  434.                     HTHnd[nOM] = window.setTimeout("if(nOM>0)if(!InMenu())Hide()", HideSpeed);
  435.         }
  436.     }
  437.     
  438.     function FormsTweak(state) {
  439. //IE
  440. //This is an undocumented function, which can be used to hide every listbox (or combo) element on a page.
  441. //This can be useful if the menus will be displayed over an area where is a combo box, which is an element that cannot be placed behind the menus and it will always appear over the menus resulting in a very undesirable effect.
  442. //------------------------------
  443. //Version 2.0
  444. //
  445.         if(DoFormsTweak && IE)
  446.             for(var f = 0; f <= (mFrame.document.forms.length - 1); f++)
  447.                 for(var e = 0; e <= (mFrame.document.forms[f].elements.length - 1); e++)
  448.                     if(mFrame.document.forms[f].elements[e].type=="select-one")
  449.                         mFrame.document.forms[f].elements[e].style.visibility = state;
  450.     }
  451.  
  452.     function execURL(url, tframe) {
  453. //IE,NS
  454. //This function is called every time a command is triggered to jump to another page or execute some javascript code.
  455. //------------------------------
  456. //url: Encrypted URL that must be opened or executed.
  457. //tframe: If the url is a document location, tframe is the target frame where this document will be opened.
  458. //------------------------------
  459. //Version 1.1
  460. //
  461.         HideAll();
  462.         window.setTimeout("execURL2('" + url + "', '" + tframe + "')", 100);
  463.     }
  464.  
  465.     function execURL2(url, tframe) {
  466. //IE,NS
  467. //This function is called every time a command is triggered to jump to another page or execute some javascript code.
  468. //------------------------------
  469. //url: Encrypted URL that must be opened or executed.
  470. //tframe: If the url is a document location, tframe is the target frame where this document will be opened.
  471. //------------------------------
  472. //Version 1.1
  473. //
  474.         var fObj = eval(rStr(tframe));
  475.         url = rStr(url);
  476.         url.indexOf("javascript")!=url.indexOf("vbscript")?eval(url):fObj.location.href = url;
  477.     }
  478.  
  479.     function rStr(s) {
  480. //IE,NS
  481. //This function is used to decrypt the URL parameter from the triggered command.
  482. //------------------------------
  483. //Version 1.1
  484. //
  485.         s = xrep(s,"\x1E","'");
  486.         s = xrep(s,"\x1D","\x22");
  487.         s = xrep(s,"\x1C",",");
  488.         return s;
  489.     }
  490.  
  491.     function xrep(s, f, n) {
  492. //IE,NS
  493. //This function looks for any occurrence of the f string and replaces it with the n string.
  494. //------------------------------
  495. //Version 1.0
  496. //
  497.         var tmp = s.split(f);
  498.         return tmp.join(n);
  499.     }
  500.  
  501.     function hNSCClick(e) {
  502. //NS
  503. //This function executes the selected command's trigger code.
  504. //------------------------------
  505. //Version 1.0
  506. //
  507.         eval(this.TCode);
  508.     }
  509.     
  510.     function CBparseInt(n) {
  511. //IE,NS
  512. //This function fixes a bug in Navigator's parseInt() function for the Mac.
  513. //------------------------------
  514. //Version 1.3
  515. //
  516.         if(typeof(n)=="number"||typeof(n)=="string")
  517.             return (!IsWin&&!SM?n:parseInt(n))*1;
  518.         return 0;
  519.     }
  520.  
  521.     function HideAll() {
  522. //IE,NS
  523. //This function will hide all the currently opened menus.
  524. //------------------------------
  525. //Version 1.0
  526. //
  527.         while(nOM>0)
  528.             Hide();
  529.     }
  530.  
  531.     function GetLeftTop() {
  532. //IE,NS
  533. //This function returns the scroll bars position on the menus frame.
  534. //------------------------------
  535. //Version 2.0
  536. //
  537.         if(IE)
  538.             return [OP?0:SM?mFrame.scrollX:mFrame.document.body.scrollLeft,OP?0:SM?mFrame.scrollY:mFrame.document.body.scrollTop];
  539.         if(NS)
  540.             return [mFrame.pageXOffset,mFrame.pageYOffset];
  541.     }
  542.     
  543.     function tHideAll() {
  544. //IE,NS
  545. //This function is called when the mouse is moved away from a hotspot to close any opened menu.
  546. //------------------------------
  547. //Version 1.0
  548. //
  549.         HTHnd[nOM] = window.setTimeout("if(!InMenu()&&nOM==1)HideAll(); else HTHnd[nOM]=0;", HideSpeed);
  550.     }
  551.  
  552.     function GetWidthHeight() {
  553. //IE,NS
  554. //This function returns the width and height of the menus frame.
  555. //------------------------------
  556. //Version 2.0
  557. //
  558.         if(IE&&!SM)
  559.             return [mFrame.document.body.clientWidth,mFrame.document.body.clientHeight];
  560.         if(NS||SM)
  561.             return [mFrame.innerWidth,mFrame.innerHeight];
  562.     }
  563.     
  564.     function GetCStyle(cmc) {
  565. //IE,SM
  566. //This functions completes the style of command with all the common
  567. //parameters from the original style code.
  568. //------------------------------
  569. //Version 1.0
  570. //
  571.         return "position: absolute; left:" + cmc.left + 
  572.                "; top: " + cmc.top + 
  573.                "; width: " + (OP?cmc.pixelWidth:cmc.width) + 
  574.                "; height: " + (OP?cmc.pixelHeight:cmc.height) + "; ";
  575.     }
  576.     
  577.     function SetUpEvents() {
  578. //IE,NS
  579. //This function initializes the frame variables and setups the event handling.
  580. //------------------------------
  581. //Version 1.9
  582. //
  583.         onerror = errHandler;
  584.         if(typeof(mFrame)=="undefined")
  585.         mFrame = eval(frames['self']);
  586.         if(typeof(mFrame)=="undefined")
  587.             window.setTimeout("SetUpEvents()",10);
  588.         else {
  589.             if(NS) {
  590.                 mFrame.captureEvents(Event.MOUSEMOVE);
  591.                 mFrame.onmousemove = HideMenus;
  592.                 PrepareEvents();
  593.             }
  594.             if(IE) {
  595.                 document.onmousemove = HideMenus;
  596.                 mFrame.document.onmousemove = document.onmousemove;
  597.             }
  598.         }
  599.     }
  600.     
  601.     function errHandler(sMsg,sUrl,sLine) {
  602. //IE,NS
  603. //This function will trap any errors generated by the scripts and filter the unhandled ones.
  604. //------------------------------
  605. //Version 1.0
  606. //
  607.         if(sMsg.substr(0,16)!="Access is denied"&&sMsg!="Permission denied")
  608.             alert("DHTML Menu Builder Java Script Error\n" +
  609.                   "\nDescription: " + sMsg +
  610.                   "\nSource: " + sUrl +
  611.                   "\nLine: "+sLine);
  612.         return true;
  613.     }
  614.  
  615.     function PrepareEvents() {
  616. //NS
  617. //This function is called right after the menus are rendered.
  618. //It has been designed to attach the OnClick event to the <layer> tag. This is being
  619. //done this way because Navigator does not support a click inline event capturing on
  620. //the layer tag... duh!
  621. //------------------------------
  622. //Version 2.7
  623. //
  624.         for(var l=0; l<mFrame.document.layers.length; l++) {
  625.             var lo = mFrame.document.layers[l];
  626.             if(lo.layers.length) {
  627.                 lo.w = lo.clip.width;
  628.                 lo.h = lo.clip.height;
  629.                 for(var sl=0; sl<lo.layers[0].layers.length; sl++) {
  630.                     var slo = mFrame.document.layers[l].layers[0].layers[sl];
  631.                     if(slo.name.indexOf("EH")>0) {
  632.                         slo.document.onmouseup = hNSCClick;
  633.                         slo.document.TCode = nTCode[slo.name.split("EH")[1]];
  634.                     }                    
  635.                 }
  636.             }
  637.         }
  638.     }
  639.  
  640.     if(IE)
  641.         with(document) {
  642.             open();
  643.             write("<div id=\"Grupa_g│≤wna\" style=\"position: absolute; left:0; top:0; width: 94; height: 34; z-index: 100; visibility: hidden\"><div style=\"width: 94; height: 34; background-color: #C0C0C0; color: #000000; border-left: #E0E0E0 solid 1; border-right: 1 solid #808080; border-top: 1 solid #E0E0E0; border-bottom: 1 solid #808080;\"><div align=left style=\"position: absolute; border: 0; left: 1; top: 1; width: 92; height: 13; font-family: Tahoma; font-size: 8pt; font-weight: none; font-style: none; color: #000000; cursor: hand; background-color: #C0C0C0;\" id=0 OnMouseOver=\"frames[\'self\'].HoverSel(0,\'_\',\'_\',this);window.status=\'Strona pierwsza\';\" OnClick=\"frames[\'self\'].execURL(\'element_1.htm\', \'frames[self]\');\"><span style=\"position: absolute; left: 0; top: 0; width: 90;\">Strona pierwsza</span></div><div style=\"position: absolute; top: 17; left: 8; width: 78; height: 1; background-color: #000000;\"><font size=1></font></div><div align=left style=\"position: absolute; border: 0; left: 1; top: 20; width: 92; height: 13; font-family: Tahoma; font-size: 8pt; font-weight: none; font-style: none; color: #000000; cursor: hand; background-color: #C0C0C0;\" id=1 OnMouseOver=\"frames[\'self\'].HoverSel(0,\'_\',\'_\',this);window.status=\'Logo ENTERA\';\" OnClick=\"frames[\'self\'].execURL(\'enter.jpg\', \'frames[self]\');\"><span style=\"position: absolute; left: 0; top: 0; width: 90;\">Logo ENTERA</span></div></div></div>");
  644.             close();
  645.         }
  646.     if(NS)
  647.         with(document) {
  648.             open();
  649.             write("<layer name=Grupa_g│≤wna top=0 left=0 width=94 height=34 z-index=100 bgColor=#E0E0E0 visibility=hidden><layer bgColor=\"#C0C0C0\" left=1 top=1 width=92 height=32 z-index=101><layer name=MC1EH1 left=0 top=0 width=92 height=13 z-index=103 OnMouseOver=\"frames[\'self\'].NSHoverSel(0,this,\'#0000FF\');window.status=\'Strona pierwsza\';\"></layer><layer name=MC1 left=0 top=0 width=92 height=13 z-index=102 bgcolor=#C0C0C0><p align=left><font face=Tahoma point-size=8 color=#000000>Strona pierwsza</font></layer><layer top=16 left=4 width=86 height=1 z-index=100 bgcolor=#000000></layer><layer name=MC3EH3 left=0 top=19 width=92 height=13 z-index=103 OnMouseOver=\"frames[\'self\'].NSHoverSel(0,this,\'#0000FF\');window.status=\'Logo ENTERA\';\"></layer><layer name=MC3 left=0 top=19 width=92 height=13 z-index=102 bgcolor=#C0C0C0><p align=left><font face=Tahoma point-size=8 color=#000000>Logo ENTERA</font></layer></layer></layer>");
  650.             close();
  651.         }
  652. SetUpEvents();
  653.  
  654.  
  655.  
  656.